        vm.<%= entityInstancePlural %> = [];
        <%_ if (fieldsContainBlob) { _%>
        vm.openFile = DataUtils.openFile;
        vm.byteSize = DataUtils.byteSize;
        <%_ } _%>
        vm.loadAll = function() {
            <%= entityClass %>.query(function(result) {
                vm.<%= entityInstancePlural %> = result;
            });
        };
        <%_ if (searchEngine == 'elasticsearch') { _%>

        vm.search = function () {
            if (!vm.searchQuery) {
                return vm.loadAll();
            }
            <%= entityClass %>Search.query({query: vm.searchQuery}, function(result) {
                vm.<%= entityInstancePlural %> = result;
            });
        };<%_ } _%>

        vm.loadAll();
